const {
  DataTypes
} = require('sequelize');

module.exports = sequelize => {
  const attributes = {
    ent_id: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "id",
      field: "ent_id",
      unique: "ent_id"
    },
    user_id: {
      type: DataTypes.INTEGER(11),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "发布者id",
      field: "user_id"
    },
    ent_title: {
      type: DataTypes.STRING(255),
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "委托标题",
      field: "ent_title"
    },
    tab_ids: {
      type: DataTypes.STRING(255),
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "技术标签",
      field: "tab_ids"
    },
    ent_content: {
      type: DataTypes.TEXT,
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "委托内容",
      field: "ent_content"
    },
    ent_price: {
      type: DataTypes.DOUBLE,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "委托价格",
      field: "ent_price"
    },
    creation_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
      primaryKey: false,
      autoIncrement: false,
      comment: "创建时间",
      field: "creation_time"
    },
    update_time: {
      type: DataTypes.DATE,
      allowNull: true,
      defaultValue: sequelize.literal('CURRENT_TIMESTAMP'),
      primaryKey: false,
      autoIncrement: false,
      comment: "最近一次修改时间",
      field: "update_time"
    },
    is_accept: {
      type: DataTypes.INTEGER(1),
      allowNull: true,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "是否已被接下委托",
      field: "is_accept"
    },
    is_finish: {
      type: DataTypes.INTEGER(1),
      allowNull: true,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "是否完成",
      field: "is_finish"
    },
    is_delete: {
      type: DataTypes.INTEGER(1),
      allowNull: true,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "是否删除",
      field: "is_delete"
    },
    tags: {
      type: DataTypes.STRING(255),
      allowNull: true,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "委托标签",
      field: "tags"
    },
    ent_biography: {
      type: DataTypes.TEXT,
      allowNull: false,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "委托简介",
      field: "ent_biography"
    },
    ent_cover: {
      type: DataTypes.STRING(255),
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "封面",
      field: "ent_cover"
    },
    ent_path: {
      type: DataTypes.STRING(255),
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "委托文件存放路径",
      field: "ent_path"
    },
    status: {
      type: DataTypes.INTEGER(11),
      allowNull: true,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "委托审核状态",
      field: "status"
    }
  };
  const options = {
    tableName: "entrusts",
    comment: "",
    indexes: []
  };
  const EntrustsModel = sequelize.define("entrusts_model", attributes, options);
  return EntrustsModel;
};